import java.util.Scanner;

public class demo01 {
    //完全数计算
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int count=0;
        for (int i = 2; i <= n; i++) {
            if(check(i)){
                count++;
            }
        }
        System.out.println(count);
    }
    private static boolean check(int n){
        int sum=1;
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if(n%i==0){
                if(i==Math.sqrt(n)){
                    sum+=i;
                }else {
                    sum += i + (n / i);
                }
            }
        }
        if(sum!=n){
            return false;
        }
        return true;
    }
}
